<admintpl file="header" />
<script src="__PUBLIC__/js/datePicker/jquery-ui.min.js"></script>
<link href="__PUBLIC__/js/datePicker/jquery-ui.min.css" rel="stylesheet">
</head>
<style>
    .ui-datepicker-calendar {
        display: none;
    }
</style>
<body>
<div class="wrap js-check-wrap">
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#">汇闻币收支明细</a></li>
        </ul>

        <form class="well form-search" id="query_form" method="post" action="{:U('Admin/HwbPool/index')}">
            <div class="control-group">
                <div id="city_1">
                <input type="text" name="start_date" value="<?php if($start_date){echo $start_date;}else{echo date('Y-m', time());}?>" id="datepicker">
                    <!--<input type="submit" id="queryBtn" data-action="{:U('Admin/HwbPool/index')}" class="btn btn-primary col-lg-6" value="搜索" />-->
                <button type="submit"  class="btn btn-default">提交</button>
                </div>
            </div>
        </form>

        <div class="panel panel-default">
            <table class="table">
                <th>当月收入</th><th>当月支出</th><th>余额</th>
                <tr><td>{$month_income}</td><td>{$month_expenditure}</td><td>{$month_balance}</td></tr>
            </table>
        </div>

        <div>
            <p>
                <button type="button" onclick="add_record();" class="btn btn-default btn-lg">设置</button>
                <button type="button" onclick="exportExcel();" class="btn btn-default btn-lg">导出</button>
            </p>
        </div>

        <form class="js-ajax-form" action="" method="post">
            <table class="table table-hover table-bordered">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>操作人</th>
                    <th>类型</th>
                    <th>充值金额</th>
                    <th>汇闻币</th>
                    <th>余额</th>
                    <th>交易时间</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.operator}</td>
                        <td>{$vo.type_zh}</td>
                        <td>{$vo.recharge_amount}</td>
                        <td><?php if($vo['huiwenbi'] > 0 ){echo '+'.$vo['huiwenbi'];}else{echo $vo['huiwenbi'];}?></td>
                        <td>{$vo.balance}</td>
                        <td>{$vo.create_time}</td>
                    </tr>
                </foreach>
                </tbody>
            </table>
        </form>
        <div class="pagination">{$page}</div>
    </div>

</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $(function () {
        $('#datepicker').datepicker({
            monthNamesShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],  // 区域化月名为中文
            prevText: '上月',         // 前选按钮提示
            nextText: '下月',         // 后选按钮提示
            changeYear: true,          // 年下拉菜单
            changeMonth: true,             // 月下拉菜单
            showButtonPanel: true,         // 显示按钮面板
            showMonthAfterYear: true,  // 月份显示在年后面
            currentText: "本月",         // 当前日期按钮提示文字
            closeText: "选择",           // 关闭按钮提示文字
            dateFormat: "yy-mm",       // 日期格式
            onClose: function(dateText, inst) {         // 关闭事件
                var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                $(this).datepicker('setDate', new Date(year, month, 1));
            }
        });
    })
    function add_record(){
        layer.open({
            type: 2,
            //skin: 'layui-layer-lan',
            title: '',
            fix: false,
            shadeClose: true,
            maxmin: true,
            area: ['1000px', '500px'],
            content: "<?php echo U('Admin/HwbPool/addRecord')?>",
            end: function(){
                location.reload();
            }
        });
    }
    
    function exportExcel() {
        var sel_date = $('#datepicker').val();
        var export_url = "{:U('Admin/HwbPool/ExportExcel')}" + "&date=" + sel_date;
        window.location.href = export_url;
    }
</script>
</body>
</html>